Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#FF8247",
    list: [{
      pagePath: "/pages/map/driverServer/driverServer",
      iconPath: "/images/driver/dache2.jpg",
      selectedIconPath: "/images/driver/dache2.jpg",
      text: "打车"
    },
     {
      pagePath: "/pages/map/agent/agent",
      iconPath: "/images/driver/daijia.jpg",
      selectedIconPath: "/images/driver/daijia.jpg",
      text: "代驾"
    },
    //  {
    //   pagePath: "/pages/Shopping/index",
    //   iconPath: "/images/driver/sc.jpg",
    //   selectedIconPath: "/images/driver/sc.jpg",
    //   text: "商城"
    // },
     {
      pagePath: "/pages/map/my/my",
      iconPath: "/images/driver/wd.jpg",
      selectedIconPath: "/images/driver/wd.jpg",
      text: "我的"
    },
  ]
  },
  attached() {
  },
  methods: {
    switchTab(e) {

       
        var p = e.currentTarget.dataset.index
        if( p == 0 ){
          p = 2 
          wx.setStorage({
            data: p ,
            key: 'travel_type',
          })
        } else if( p == 1 ){
            p = 1
            wx.setStorage({
              data: p ,
              key: 'travel_type',
            })
        }
        
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  }
})